package com.wenresearch.orion.demoapp.screen.accordion;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;

import com.wenresearch.orion.components.ui.accordion.UiAccordion;
import com.wenresearch.orion.components.ui.accordion.UiAccordionPanel;

public class AccordionScreen extends MainScreen {

	private UiAccordionPanel panel;

	public AccordionScreen() {

		panel = new UiAccordionPanel();

		// Create new accordion
		UiAccordion acc1 = new UiAccordion("Friends", getFriendsContent());
		panel.add(acc1);
		
		UiAccordion acc2 = new UiAccordion("Family", getFamilyContent());
		panel.add(acc2);
		
		UiAccordion acc3 = new UiAccordion("Settings", getSettingsContent());
		panel.add(acc3);
		
		getMainManager().add(panel);
	}

	/**
	 * Construct content for first accordion
	 * @return content manager
	 */
	private VerticalFieldManager getFriendsContent() {
		VerticalFieldManager manager = new VerticalFieldManager();
		
		manager.add(new LabelField("Put any content here", Field.FOCUSABLE));
		
		return manager;
	}
	/**
	 * Construct content for second accordion
	 * @return content manager
	 */
	private VerticalFieldManager getFamilyContent() {
		VerticalFieldManager manager = new VerticalFieldManager();
		
		manager.add(new LabelField("Put any content here", Field.FOCUSABLE));
		
		return manager;
	}
	/**
	 * Construct content for settings (3rd) accordion
	 * @return content manager
	 */
	private VerticalFieldManager getSettingsContent() {
		VerticalFieldManager manager = new VerticalFieldManager();
		
		ButtonField btnImportContact = new ButtonField("Import Contact", ButtonField.CONSUME_CLICK | Field.FOCUSABLE | Field.USE_ALL_WIDTH);
		manager.add(btnImportContact);
		
		return manager;
	}

	/* (non-Javadoc)
	 * @see net.rim.device.api.ui.container.MainScreen#onSavePrompt()
	 */
	protected boolean onSavePrompt() {
		return true;
	}
	
	
}
